/**
 * Created by vincent on 2017/9/28.
 */
moduleQuiz.controller('AddQuizTopic', function ($$CambioConfig, $scope, $filter, $log, LoadingService, DialogService, EnumService) {
    initPage($scope);
    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.newTopic = {};

    $scope.cancel = function () {
        DialogService.close();
    };

    $scope.submit = function () {
        if ($scope.addGTForm.$valid) {
            $scope.newTopic.type = EnumService.getEnumKey($scope.newTopic.typeOption);
            if (StringUtils.isNlOrUndOrEmpty($scope.currentGaugeTopicGroup.gaugeTopics)) {
                $scope.currentGaugeTopicGroup.gaugeTopics = [];
            }
            $scope.currentGaugeTopicGroup.gaugeTopics.push($scope.newTopic);
            DialogService.close();
        }
    };

});